// 生成基础curd模块
// npm run generate resource 模块名 ,
// 或者 node commond generate resource 模块名
const path = require("path");
const generateResource = require("./commond/generateResource");
const unloadResource = require("./commond/unloadResource");
const commond = process.argv[2];
const type = process.argv[3];
const params = process.argv[4];

if (!commond) throw new Error("缺少参数commond");

const dirname = path.join(__dirname);

if (commond === "generate") {
	if (!params) {
		throw new Error("缺少模块名");
	}
	if (type === "resource") {
		generateResource(params, dirname);
	}

	if (type === "unload") {
		unloadResource(params, dirname);
	}
}
